package cn.tedu.charging.cost.dao.repository.impl;

import cn.tedu.charging.cost.dao.mapper.CostRuleMapper;
import cn.tedu.charging.cost.dao.repository.CostRuleRepository;
import cn.tedu.charging.cost.pojo.po.CostRulePO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CostRuleRepositoryImpl implements CostRuleRepository {

    @Autowired
    private CostRuleMapper costRuleMapper;


    @Override
    public List<CostRulePO> getCostRuleByStationId(Integer stationId) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("station_id",stationId);
        return costRuleMapper.selectList(queryWrapper);
        //每次如果查询返回空 都会创建一个
        //return new ArrayList<>();
        //当你的返回值 是空list的时候 更推荐返回 Collections.emptyList();
        //全局只有一个 避免创建过多的空list 从而节省资源
        //return Collections.emptyList();
    }
}
